<?php

namespace App\Admin\Renderable;

use Dcat\Admin\Support\LazyRenderable;
use Dcat\Admin\Widgets\Table;
use Faker\Factory;
use App\Models\Device;

class DeviceTable extends LazyRenderable
{
    public function render()
    {
        $data = [];
        $id = $this->key;
        $device = Device::where(['projectId'=>$id])->select('cid','devicename','created_at')->get()->toArray();
        // print_r($device);die;
        // $faker = Factory::create();
        // print_r($id);die;
        // for ($i = 0; $i < 5; $i++) {
        //     $data[] = [
        //         $faker->PhoneNumber,
        //         $faker->Company,
        //         $faker->date(),
        //     ];
        // }

        return Table::make(['Cid', 'Devicename', 'created_at'], $device);
    }
}
